
var EventUtil = {    
			  addHandler: 
			    function(element, type, handler)
			    {        
			    	if (element.addEventListener){ 
			    	    element.addEventListener(type, handler, false);    
			    	} 
			    	else if(element.attachEvent){
			    	    element.attachEvent("on" + type, handler); 
			    	} 
			    	else 
			    	{            
			    		element["on" + type] = handler;
			         }
			     },
			  removeHandler: 
			     function(element, type, handler)
			     {        
			     	if (element.removeEventListener){ 
			     	     element.removeEventListener(type, handler, false);  
			     	} 
			     	else if (element.detachEvent){ 
			     	    element.detachEvent("on" + type, handler); 
			     	} 
			     	else
			     	{   
			     		element["on" + type] = null;        
			     	}    
			     }
	    };


var getid=function(myid) {
	return document.getElementById(myid);
};
var appear=function(check,div1) {
	 // body...  
	 return function() {
	 	 // body...  
	 	 // div1.style.display = "block";
	 	 if (check.checked==true) 
	 	 {
	 	 	div1.style.display = 'block';
	 	 }else{
	 	 	div1.style.display = 'none';
	 	 }

	 	/* else(check.checked==false)
	 	 {
	 	 	div1.style.display = 'none';
	 	 }*/
	 	 /*if (check.checked) {
	 	 	div1.style.display = 'block';
	 	 }*/

	 }
}

window.onload=function() {
	 // body...  
	var div1=getid("type-write");
	var check=getid("myonoffswitch");
	var sub=getid("submit");
	EventUtil.addHandler(check,"change",appear(check,div1));
}

